// TOWN SCRIPT
//    Town 13: Aries

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

// flags:
// 13, 0 = Terra's door sdf
// 13, 2 = Asked Terra what she does
// 13, 3 = Given Demonslayer already
// 13, 4 = Purrly conversation flag
// 13, 5 = ssLizzy conversation flag

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(5);

	set_name(6, "Terra");
	set_char_dialogue_pic(6, 535, 0);
	set_name(7, "Tahlatei");
	set_char_dialogue_pic(7, 1913, 0);
	set_name(17, "Purrly");
	set_char_dialogue_pic(17, 1924, 0);
	set_name(18, "Walten");
	set_char_dialogue_pic(18, 1949, 0);
	set_name(19, "ssLizzy");
	set_char_dialogue_pic(19, 1952, 0);
	set_name(20, "Mayor Johnson");
	set_char_dialogue_pic(20, 1954, 0);
	set_name(24, "Jack");
	set_char_dialogue_pic(24, 1958, 0);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(8, "Obey the law.");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(9, "Stay out of trouble.");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(10, "Don't loiter.");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(11, "Watch your step.");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(21, "Mooo");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(22, "Moooo");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(23, "Woof Woof");
	}
break;

beginstate 10;
	message_dialog("The bookshelves contain various papers, journals and other artifacts pertaining to the running of Aires.", "You leaf through a few records, but find nothing useful for your quest.");
break;

beginstate 11;
	message_dialog("Contained in the bookshelf are several books written in a language you do not recognize.", "They could be novels or instruction manuals for all you know.");
	if (get_flag(13, 1) == 0) {
		// if rune reading skill above 20-30, give player something for their trouble...
		if (get_skill_total(42) >= (get_ran(1, 1, 11) + 19)) {
			set_state_continue(12);
		}
	}
break;

beginstate 12;
	set_flag(13, 1, 1);
	message_dialog("To your surprise, you can make sense of one of the books you are leafing through.", "The book contains instructions for increasing your magical proficiency which the whole group picks up.");
	alter_stat(1000, 27, 1);
break;

beginstate 13;
	message_dialog("The bookcase is filled with the sort of trashy novels you'd expect to find in a barracks.", "Some of them seem quite hard-core, based on the title.");
break;

beginstate 14;
	// you killed Terra...
	if (get_flag(13, 3) == 0) {
		// drop Demonslayer
		set_flag(13, 3, 2);
		put_item_on_spot(39, 38, 450);
		print_str_color("As Terra dies, an ornate sword falls on the floor from her robes.", 2);
	}
	else {
		// already have demonslayer, set to be seized anyway..
		inc_flag(13, 3, 1);
	}
break;
